//
//  StrategyDetailCollectionReusableView.m
//  MyDIYHouse
//
//  Created by dlios on 15-6-30.
//  Copyright (c) 2015年 李平洋. All rights reserved.
//

#import "StrategyDetailCollectionReusableView.h"
#define WIDTH self.frame.size.width

@implementation StrategyDetailCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        
        
        self.titleLabel = [[UILabel alloc] init];
        [self addSubview:self.titleLabel];
        
        self.titleLabel.font = [UIFont systemFontOfSize:18];
        //self.titleLabel.backgroundColor = [UIColor grayColor];
        [self.titleLabel release];
        
        self.userPicImageView = [[UIImageView alloc] init];
        [self addSubview:self.userPicImageView];
        //self.userPicImageView.layer.borderWidth= 1;
        self.userPicImageView.layer.cornerRadius = 20;
        self.userPicImageView.layer.masksToBounds=YES;
        self.userPicImageView.backgroundColor =[UIColor grayColor];
        [self.userPicImageView release];
        
        self.userNameLabel = [[UILabel alloc] init];
        [self addSubview:self.userNameLabel];
        self.userNameLabel.numberOfLines = 0;//设置为最多行数
        [self.userNameLabel sizeToFit];
        //self.userNameLabel.backgroundColor = [UIColor grayColor];
        [self.userNameLabel release];
        
        self.descriptionLabel = [[UILabel alloc] init];
        [self addSubview:self.descriptionLabel];
        
        
        // self.descriptionLabel.backgroundColor = [UIColor grayColor];
        [self.descriptionLabel release];
        
    }
    return self;
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.titleLabel.frame = CGRectMake(20, 30, WIDTH-40,50);
    self.titleLabel.numberOfLines = 0;//设置为最多行数
    [self.titleLabel sizeToFit];
    self.userPicImageView.frame = CGRectMake(20, 50+self.titleLabel.frame.size.height, 40, 40);
    self.userNameLabel.frame = CGRectMake(80, 50+self.titleLabel.frame.size.height, 200, 40);
    
    self.descriptionLabel.frame = CGRectMake(20, 110+self.titleLabel.frame.size.height, WIDTH-40, 100);
    self.descriptionLabel.numberOfLines = 0;//设置为最多行数
    [self.descriptionLabel sizeToFit];
    
    
    
    self.frame = CGRectMake(0, 0, WIDTH, 120+self.titleLabel.frame.size.height+self.descriptionLabel.frame.size.height);
    
    [self.delegate changeSize];
    
}




@end
